<template>
  <view class="container">
    <uni-forms :modelValue="form" label-width='220rpx'>
      <uni-forms-item label="阶段年龄1" name="age1">
        <uni-easyinput type="number" v-model="form.age1" placeholder="请输入阶段年龄1"></uni-easyinput>
      </uni-forms-item>
      <uni-forms-item label="申领金额1" name="form.amount1">
        <uni-easyinput type="number" v-model="form.amount1" placeholder="请输入申领金额1"></uni-easyinput>
      </uni-forms-item>
      <uni-forms-item label="阶段年龄2" name="age2">
        <uni-easyinput type="number" v-model="form.age2" placeholder="请输入阶段年龄2"></uni-easyinput>
      </uni-forms-item>
      <uni-forms-item label="申领金额2" name="form.amount2">
        <uni-easyinput type="number" v-model="form.amount2" placeholder="请输入申领金额2"></uni-easyinput>
      </uni-forms-item>
      <uni-forms-item label="阶段年龄3" name="age3">
        <uni-easyinput type="number" v-model="form.age3" placeholder="请输入阶段年龄3"></uni-easyinput>
      </uni-forms-item>
      <uni-forms-item label="申领金额3" name="form.amount3">
        <uni-easyinput type="number" v-model="form.amount3" placeholder="请输入申领金额3"></uni-easyinput>
      </uni-forms-item>
      <uni-forms-item label="阶段年龄4" name="age4">
        <uni-easyinput type="number" v-model="form.age4" placeholder="请输入阶段年龄4"></uni-easyinput>
      </uni-forms-item>
      <uni-forms-item label="申领金额4" name="form.amount4">
        <uni-easyinput type="number" v-model="form.amount4" placeholder="请输入申领金额4"></uni-easyinput>
      </uni-forms-item>

    </uni-forms>
    <view class="tip">
      <uni-icons type="help" size="20"></uni-icons>
      <text style="font-size: 12px;">
        填写说明：
        【{{ currentSyr.name }}】年满【{{ form.age1 }}】周岁后，截止到【{{ form.age2 }}】前，经提前书面通知受托人且向受托人提供【{{
          currentSyr.name
        }}】有效的身份证明等材料后，【{{ currentSyr.name }}】可在每个自然年申领不超过其信托受益权下的【{{ form.amount1 }}】万元。
        【{{ currentSyr.name }}】年满【{{ form.age2 }}】周岁后，截止到【{{ form.age3 }}】前，经提前书面通知受托人且向受托人提供【{{
          currentSyr.name
        }}】有效的身份证明等材料后，【{{ currentSyr.name }}】可在每个自然年申领不超过其信托受益权下的【{{ form.amount2 }}】万元。
        【{{ currentSyr.name }}】年满【{{ form.age3 }}】周岁后，截止到【{{ form.age4 }}】前，经提前书面通知受托人且向受托人提供【{{
          currentSyr.name
        }}】有效的身份证明等材料后，【{{ currentSyr.name }}】可在每个自然年申领不超过其信托受益权下的【{{ form.amount3 }}】万元。
        如无需填写，则选择跳过。
      </text>
    </view>
    <view class="bottom" style="display: flex;justify-content: center">
      <button class="button" type="primary" @click="jump(300)">跳过</button>
      <button class="button" type="primary" @click="submit">下一步</button>
    </view>
  </view>
</template>

<script>
import userInfoMixin from "../../common/js/userInfoMixin";

export default {
  mixins: [userInfoMixin],
  data() {
    return {
      name: '218',
      count: 0, // 表示当前用户下受益人的数量
      currentCount: 0, // 表示当前受益人的下标
      form: {
        age1: '',
        amount1: '',
        age2: '',
        amount2: '',
        age3: '',
        amount3: '',
        age4: '',
        amount4: '',
      }
    }
  },
  created() {
    // 获取受益人数量
    let db = wx.cloud.database()
    db.collection('JCRS').count().then(res => {
      this.count = res.total
    })


    db.collection('JCRS').where({
      name: this.name
    }).get({
      success(res) {
        console.log(res)
      }
    })
  },
  methods: {
    submit() {

      this.submitData({
        key: 'jdsl',
        data: this.form
      }, '300')

    },
  }
}
</script>

<style>

</style>
